package br.uvv.Service;

import java.io.Serializable;
import java.util.List;

import br.uvv.Dao.ArtefatoDAO;
import br.uvv.Model.Artefato;
import br.uvv.Util.DAOException;
import br.uvv.Util.RNException;

public class ArtefatoService implements Serializable {

	private static final long serialVersionUID = 2310091665586839549L;
	
	private ArtefatoDAO artefatoDao = new ArtefatoDAO();

	public List<Artefato> listarArtefato() throws RNException{
		try {
			return artefatoDao.listar();
		} catch (DAOException e){
			throw new RNException(e);
		}
	}

	public Artefato selecionarArtefato(Long id) throws RNException {
		try {
			return artefatoDao.selecionar(id);
		} catch (DAOException e){
			throw new RNException(e);
		}
	}

	public void removerArtefato(Artefato artefatoInstance) throws RNException {
		try {
			artefatoDao.remover(artefatoInstance);
		} catch (DAOException e){
			throw new RNException(e);
		}
	}

	public void atualizarArtefato(Artefato artefatoInstance) throws RNException {
		try {
			artefatoDao.salvar(artefatoInstance);
		} catch (DAOException e){
			throw new RNException(e);
		}
	}

	public void salvarArtefato(Artefato artefatoInstance) throws RNException {
		try {
			artefatoDao.salvar(artefatoInstance);
		} catch (DAOException e){
			throw new RNException(e);
		}
	}	
}